package ch05;

import ch05.sj1.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class TestCh05 {

    @Test
    public void testIoc(){

//        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext_ch05IOC.xml");
        ApplicationContext context = new FileSystemXmlApplicationContext("resources/applicationContext_ch05IOC.xml");

       /* HelloSpring h = (HelloSpring) context.getBean("spring_ys");//new HelloSpring();
        //h.setHello("你好Spring");
        h.show();*/

        User lufei = context.getBean("lufei",User.class);
        User zhugeliang = context.getBean("zhugeliang",User.class);

        /*System.out.println(lufei.getMessage());
        System.out.println(zhugeliang.getMessage());*/
/*        System.out.println(zhugeliang.getRole());
        System.out.println(zhugeliang.getSex());*/

        System.out.println(zhugeliang);

    }
}
